/* TCSS 590A - Cybernetics and Systems
 * Group Project - Modeling
 * By Barry Jones, Naren Meadem, Michael Pitts, Yuan Tao
 * Fall 2012, University of Washington, Tacoma
 */
package model.delayed;


/**
 * The core methods for an Account handling money.
 * @author Michael Pitts
 * @version Nov 26, 2012
 */
public interface Account
{

	/**
	 * Gets the value of this Account.
	 * @return a whole number.
	 */
	public long getValue();
	
	/**
	 * Gets the interest rate of this Account.
	 * @return a non-negative fraction.
	 */
	public double getRate();
	
	/**
	 * Changes the value by the indicated amount, negatives will decrease the value.  
	 * Note that these changes are instantaneous.
	 * @param the_value how much the value should change.
	 * @see Account#getEvent(long)
	 */
	public void changeValue(final long the_value);
	
	/**
	 * Generates a deposit Event, which will eventually add money to this Account.
	 * @param the_value is the positive amount being added.
	 * @param the_time is the current time.
	 * @return an Event for the eventual deposit.
	 */
	public Event deposit(final long the_value, final long the_time);
	
	/**
	 * Generates a withdrawal Event for this Account.
	 * @param the_value is the negative value to remove.
	 * @param the_time is the current time.
	 * @return an Event for this Account that will generate the withdrawal.
	 */
	public Event withdraw(final long the_value, final long the_time);
	
	/**
	 * Adjusts the value of the Account by the interest rate.
	 */
	public void addInterest();
	
	/**
	 * Signifies if this Account is in a legal state or not.  The Model will stop if it finds
	 * an Account in an illegal state.
	 * @return true if this Account is in a legal state, false otherwise.
	 */
	public boolean inLegalState();
}
